package com.computer.network.po;


import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
 * 用户表
 * 易错：（继承userDetails后的元素自动生成getUserName返回值为空，需手动设置）
 *
 * @Author cgs
 * @Date 2022/8/20 22:21
 */

public class SysUser implements Serializable, UserDetails {
    @TableId("id")
    private long id;
    private String account;
    private String userName;
    private String password;
    private java.sql.Timestamp lastLoginTime;
    private long enabled;
    private long notExpired;
    private long accountNotLocked;
    private long credentialsNotExpired;
    private java.sql.Timestamp createTime;
    private java.sql.Timestamp updateTime;
    private long createUser;
    private long updateUser;
    /**
     * 用户权限存储
     */
    @TableField(exist = false)
    private List<String> authorityList;
    /**
     * 用户角色存储
     */
    @TableField(exist = false)
    private List<Long> roleId;

    public List<Long> getRoleId() {
        return roleId;
    }

    public void setRoleId(List<Long> roleId) {
        this.roleId = roleId;
    }

    public List<String> getAuthorityList() {
        return authorityList;
    }

    public void setAuthorityList(List<String> authorityList) {
        this.authorityList = authorityList;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }


    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }


    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }


    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    public String getPassword() {
        return password;
    }

    @Override
    public String getUsername() {
        return userName;
    }


    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }

    public void setPassword(String password) {
        this.password = password;
    }


    public java.sql.Timestamp getLastLoginTime() {
        return lastLoginTime;
    }

    public void setLastLoginTime(java.sql.Timestamp lastLoginTime) {
        this.lastLoginTime = lastLoginTime;
    }


    public long getEnabled() {
        return enabled;
    }

    public void setEnabled(long enabled) {
        this.enabled = enabled;
    }


    public long getNotExpired() {
        return notExpired;
    }

    public void setNotExpired(long notExpired) {
        this.notExpired = notExpired;
    }


    public long getAccountNotLocked() {
        return accountNotLocked;
    }

    public void setAccountNotLocked(long accountNotLocked) {
        this.accountNotLocked = accountNotLocked;
    }


    public long getCredentialsNotExpired() {
        return credentialsNotExpired;
    }

    public void setCredentialsNotExpired(long credentialsNotExpired) {
        this.credentialsNotExpired = credentialsNotExpired;
    }


    public java.sql.Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(java.sql.Timestamp createTime) {
        this.createTime = createTime;
    }


    public java.sql.Timestamp getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(java.sql.Timestamp updateTime) {
        this.updateTime = updateTime;
    }


    public long getCreateUser() {
        return createUser;
    }

    public void setCreateUser(long createUser) {
        this.createUser = createUser;
    }


    public long getUpdateUser() {
        return updateUser;
    }

    public void setUpdateUser(long updateUser) {
        this.updateUser = updateUser;
    }

}
